package com.lh.music.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.lh.music.PlayApplication;
import com.lh.music.constant.Constants;

public class PlayNetReceiver extends BroadcastReceiver {
    private PlayApplication app;
    int position;
    public PlayNetReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        app= (PlayApplication) context.getApplicationContext();
        //根据不同广播  调用不同的播放功能
        switch (intent.getAction()){
            case Constants.NET_CONTINUE_ACTION:
                app.netMusic.continueNetPlay();
                break;
            case Constants.NET_PAUSE_ACTION:
                app.netMusic.pauseNetPlay();
                break;
            case Constants.NET_PLAY_ACTION:
                app.netMusic.initNetMusic(app.currentNetSongList,app.currentPosition);
                app.netMusic.stopNetPlay();
                app.netMusic.startNetPlay();
                break;
            case Constants.NET_NEXT_ACTION:
                app.netMusic.nextNetPlay();
                break;
            case Constants.NET_PREV_ACTION:
                app.netMusic.prevNetPlay();
                break;
        }
    }
}
